function watchObj(obj,key,setHandler,getHandler) {
    Object.defineProperty(obj,key,{
        enumerable:true,
        configurable:true,
        set(v) {
            setHandler(v);
        },
        get() {
            getHandler();
        }
    })
}
console.log("程序开始执行");
let person={'name':'a'};

function setHandler(v) {
    console.log("数据被放进去"+v);
}
function getHandler() {
    console.log("数据被取出来");
}

watchObj(person,'name',setHandler,getHandler);
person.name='b';
console.log(person);